import React, { Component } from 'react';
import { connect } from 'dva';
import { message, Modal, Pagination, Popconfirm, Button, Row, Col } from 'antd';
import styles from './Users.css';
import moment from 'moment';
import Factory from '../factory';
import * as datetime from '../../utils/datetime'
import dataEditCreate from '../addons/DataEdit'
import dataTableCreate from '../addons/DataTable'
import DataEditTable from '../addons/DataEditTable'
import * as common from '../../utils/common';
import Dszhrd_fhqk from './Dszhrd_fhqk'
import * as IndiDiviService from '../../services/AccountDivi';
const daoName = "Dszhrd";
const ButtonGroup = Button.Group;
const columns = [
    { title: '是否默认', width: 100, sorter: true, key: 'ISMR', dispaly: true, render: data => data.ISMR ? '是' : '否' },
    { title: '卡号', width: 160, sorter: true, key: 'CARDID', caption: "CARD.NO", render: data => data.CARD.NO, dispaly: true, filter: true },
    { title: '账号', dataIndex: 'ACNO', key: 'ACNO', width: 150, sorter: true, dispaly: true, filter: true },
    { title: '子账号', width: 100, sorter: true, dataIndex: 'BANO', key: 'BANO', dispaly: true, filter: true },
    { title: '客户名称', width: 120, sorter: true, key: 'CUNM', dataIndex: 'CUNM', dispaly: true, filter: true },
    { title: '证件号码', width: 180, sorter: true, key: 'IDNO', dataIndex: 'IDNO', dispaly: true, filter: true },
    { title: '开户机构', width: 120, sorter: true, key: 'OrganizationID', caption: "Organization.Name", render: data => data.Organization.Name, dispaly: true, filter: true },
    { title: '开户日期', width: 120, sorter: true, key: 'OPDT', caption: "OPDT", render: data => datetime.format(data.OPDT, "yyyy-MM-dd"), dispaly: true, filter: true, canEdit: true },
    { title: '起息日', width: 100, sorter: true, key: 'VLDT', caption: "VLDT", render: data => datetime.format(data.VLDT, "yyyy-MM-dd"), dispaly: true, filter: true, canEdit: true },
    { title: '到期日', width: 100, sorter: true, key: 'MADT', caption: "MADT", render: data => datetime.format(data.MADT, "yyyy-MM-dd"), dispaly: true, filter: true, canEdit: true },
    { title: '存期', width: 100, sorter: true, key: 'PERDID', caption: "PERD.Name", render: data => data.PERD.Name, dispaly: true, filter: true },
    { title: '币种', width: 100, sorter: true, key: 'CUCYID', caption: "CUCY.Name", render: data => data.CUCY.Name, dispaly: true, filter: true },
    { title: '余额', width: 100, sorter: true, dataIndex: 'ACBL', render: data => common.formatNumber(data), key: 'ACBL', dispaly: true, filter: true },
    { title: '是否认定', width: 100, sorter: true, key: 'ISDIVI', dispaly: true, render: data => data.ISDIVI ? '已认定' : '未认定' },
];
const controls = [
    { name: 'ACNO', required: true, type: 'text', label: '账号', grid: 12 / 24 },
    { name: 'BANO', required: true, type: 'text', label: '子账号', grid: 12 / 24 },
    { name: 'CUNM', required: true, type: 'text', label: '客户名称', grid: 12 / 24 },
    { name: 'IDNO', required: true, type: 'text', label: '证件号码', grid: 12 / 24 },
    {
        name: "OrganizationID", label: "开户机构", type: "tree-select", grid: 12 / 24, filterAble: true, required: true,
        fetch: { daoName: "Organization", optionTpl: 'Name', valueTpl: "ID" },
        dataType: "number", seekType: 2, placeholder: '请选择所属部门...'
    },

    { name: "OPDT", label: "开户日期", type: "date", grid: 12 / 24, dataType: "date" },
    { name: "VLDT", label: "起息日", type: "date", grid: 12 / 24, dataType: "date" },
    { name: "MADT", label: "到期日", type: "date", grid: 12 / 24, dataType: "date" },
    { name: "PERDID", label: "存期", type: "select", grid: 12 / 24, required: true, dataType: "number", fetch: { daoName: "PERD", optionTpl: 'Name', valueTpl: "ID" } },
    { name: "CUCYID", label: "币种", type: "select", grid: 12 / 24, required: true, dataType: "number", fetch: { daoName: "CUCY", optionTpl: 'Name', valueTpl: "ID" } },
    { name: "ACBL", label: '余额', type: "number", grid: 12 / 24, dataType: "number" },
    { name: "CARDID", label: "卡号", type: "number", grid: 12 / 24, required: true, dataType: "number" },

]
const columnsWaitDivi = [
    { title: '账号', width: 100, dataIndex: 'ACNO', key: 'ACNO', dispaly: true },
    { title: '子账号', width: 60, dataIndex: 'BANO', key: 'BANO', dispaly: true },
    { title: '客户名称', width: 80, dataIndex: 'CUNM', key: 'CUNM', dispaly: true }
];
const columnsDivi = [
    { title: '员工ID', dataIndex: 'EMID', key: 'EMID', width: 80, dispaly: false },
    { title: '员工编号', dataIndex: 'EMNO', key: 'EMNO', width: 80, dispaly: true },
    { title: '员工名称', width: 80, sorter: true, dataIndex: 'SysUserName', key: 'SysUserName', dispaly: true },
    { title: '开户机构', width: 80, sorter: true, dataIndex: 'OrganName', key: 'OrganName', dispaly: true },
    { title: '分户日期', width: 80, sorter: true, key: 'DSDT', caption: "DSDT", render: data => datetime.format(data.DSDT, "yyyy-MM-dd"), dispaly: true },
    { title: '分成比例', width: 80, sorter: true, dataIndex: 'DSVL', key: 'DSVL', dispaly: true },
];
const controlsWaitDivi = [
    { name: 'ACNO', required: true, type: 'text', label: '帐号', grid: 12 / 24 },
    { name: 'BANO', required: true, type: 'text', label: '子账号', grid: 12 / 24 },
    { name: 'CUNM', required: true, type: 'text', label: '客户名称', grid: 12 / 24 }
];
const controlsDivi = [
    { name: 'EMID', required: true, type: 'number', label: '员工编号', grid: 12 / 24, dataType: "number" },
    { name: 'EMNO', required: true, type: 'alphanum', label: '员工编号', grid: 12 / 24 },
    { name: 'SysUserName', required: true, type: 'text', label: '员工名称', grid: 12 / 24 },
    { name: 'OrganName', required: true, type: 'text', label: '开户机构', grid: 12 / 24 },
    { name: "DSDT", required: true, type: "date", label: "分户日期", grid: 12 / 24, dataType: "date" },
    { name: "DSVL", required: true, type: "number", label: '分成比例', grid: 12 / 24, dataType: "number" },
];
const EditFrom = dataEditCreate(daoName);
const DataTable = dataTableCreate(daoName);
class Dszhrd extends Component {
    constructor(props) {
        super(props);
        this.state = {
            dataChange: false,
            diviList: [],
            diviDisplay: {
                div1: 'block',
                div2: 'none',
                lable: '认定',
                isRD: true,
                isDivi: false
            },
            searchData: {},
            diviDataSource: [],
            ISKH: 0
        };
    }
    componentWillReceiveProps(nextProps) {
    };
    onSelectChangeHandler(newList, delKeys) {
        let diviList = this.state.diviList
        newList.map(data => {
            diviList.push(data)
        })
        delKeys.map(key => {
            const index = diviList.findIndex(divi => divi["ID"] === key)
            diviList.splice(index, 1)
        })
        this.setState({ diviList })
    }
    componentDidMount() {
        this.props.dispatch({
            type: `${daoName}/setKeyName`,
            payload: { keyName: "ID", permID: this.props.permID }
        });
        let sort = {
            field: 'OPDT',
            order: 'descend'
        }
        let whereItems = [];
        let WhereCauses = [];
        whereItems.push({
            FieldName: "1",
            Operator: "<>",
            FieldValues: '1'
        })
        WhereCauses.push({
            WhereItems: whereItems,
            RelationSign: "AND"
        })
        let seeks = WhereCauses
        this.props.dispatch({
            type: `${daoName}/fetch`,
            payload: { daoName, page: 1, pageSize: 20, sorter: sort, seeks: seeks }
        });
        this.loadOptionData();
    }
    loadOptionData() {
        let options = []
        controls.map(c => {
            if (c.fetch) {
                let f = c.fetch;
                if (c.type === 'cascader-select') {
                    f.isCascader = true;
                }
                if (c.type !== 'search') {
                    options.push(f);
                }
            }
        })
        if (daoName && options.length > 0) {
            this.props.dispatch({ type: `${daoName}/fetchOptions`, payload: { options } });
        }
    }
    findData() {
        let selectValues = '';
        let zjhm = '';
        let khmc = '';
        let kh = '';
        const form = this.refs.findForm.getForm();
        form.validateFields((err, values) => {
            if (!err) {
                if (values.ZJHM === undefined) {
                    values.ZJHM = ""
                }
                if (values.KHMC === undefined) {
                    values.KHMC = ""
                }
                if (values.KH === undefined) {
                    values.KH = ""
                }
                selectValues = values.ISDIVI;
                zjhm = values.ZJHM;
                khmc = values.KHMC;
                kh = values.KH;
            }
        });
        if (selectValues === 'all') {
            selectValues = '0,1'
        }
        let seeks = [];
        let whereItems = [];
        let WhereCauses = [];
        if (zjhm !== '' && khmc === '' && kh === '') {
            whereItems.push({
                FieldName: "IDNO",
                Operator: "=",
                FieldValues: zjhm
            });
        } else if (kh === '' && zjhm === '' && khmc !== '') {
            whereItems.push({
                FieldName: "CUNM",
                Operator: "like",
                FieldValues: khmc
            });
        } else if (kh !== '' && zjhm === '' && khmc === '') {
            whereItems.push({
                FieldName: "CARD.NO",
                Operator: "=",
                FieldValues: kh
            });
        } else if (kh !== '' && zjhm !== '' && khmc === '') {
            whereItems.push({
                FieldName: "CARD.NO",
                Operator: "=",
                FieldValues: kh
            });
            whereItems.push({
                FieldName: "IDNO",
                Operator: "=",
                FieldValues: zjhm
            });
        } else if (kh !== '' && khmc !== '' && zjhm === '') {
            whereItems.push({
                FieldName: "CARD.NO",
                Operator: "=",
                FieldValues: kh
            });
            whereItems.push({
                FieldName: "CUNM",
                Operator: "like",
                FieldValues: khmc
            });
        } else if (kh === '' && khmc !== '' && zjhm !== '') {
            whereItems.push({
                FieldName: "IDNO",
                Operator: "=",
                FieldValues: zjhm
            });
            whereItems.push({
                FieldName: "CUNM",
                Operator: "like",
                FieldValues: khmc
            });
        } else if (kh !== '' && khmc !== '' && zjhm !== '') {
            whereItems.push({
                FieldName: "IDNO",
                Operator: "=",
                FieldValues: zjhm
            });
            whereItems.push({
                FieldName: "CUNM",
                Operator: "like",
                FieldValues: khmc
            });
            whereItems.push({
                FieldName: "CARD.NO",
                Operator: "=",
                FieldValues: kh
            });
        }
        whereItems.push({
            FieldName: "ISDIVI",
            Operator: "in",
            FieldValues: selectValues
        })
        whereItems.push({
            FieldName: "ID",
            Operator: ">",
            FieldValues: '0'
        })
        WhereCauses.push({
            WhereItems: whereItems,
            RelationSign: "AND"
        })
        seeks = WhereCauses;
        this.state.diviDisplay.div1 = 'block';
        this.state.diviDisplay.div2 = 'none';
        this.state.diviDisplay.lable = '认定';
        this.state.diviDisplay.isRD = true;
        this.state.diviDisplay.isDivi = false;
        this.props.dispatch({
            type: `${daoName}/fetch`,
            payload: { daoName, seeks }
        });
    };
    dispalyDivi() {
        if (this.state.diviDisplay.isRD) {
            this.state.diviDisplay.div1 = 'none';
            this.state.diviDisplay.div2 = 'block';
            this.state.diviDisplay.lable = '返回';
            this.state.diviDisplay.isRD = false;
            this.state.diviDisplay.isDivi = true;
            this.state.diviList = [];
            const form = this.refs.diviForm.getForm();
            form.resetFields();
            this.props.dispatch({
                type: `${daoName}/setSelectedRowKeys`,
                payload: { selectedRowKeys: [] }
            });
        } else {
            this.state.diviDisplay.div1 = 'block';
            this.state.diviDisplay.div2 = 'none';
            this.state.diviDisplay.lable = '认定';
            this.state.diviDisplay.isRD = true;
            this.state.diviDisplay.isDivi = false;
            this.state.diviList = [];
            const form = this.refs.diviForm.getForm();
            form.resetFields();
            this.props.dispatch({
                type: `${daoName}/setSelectedRowKeys`,
                payload: { selectedRowKeys: [] }
            });
        }
        this.setState({})
    };
    searchHandle(data) {
        this.state.searchData = data
    };
    diviAdd() {
        let data = {}
        let formatDate = null
        const form = this.refs.diviForm.getForm();
        let isOK = true;
        form.validateFields((err, values) => {
            if (!err) {
                if (values.ZB === undefined || values.ZB === '') {
                    message.info('占比不能为空！');
                    isOK = false;
                }
                if (values.YG === undefined || values.YG === '') {
                    message.info('员工不能为空！');
                    isOK = false;
                }
                if (values.YF === undefined) {
                    message.info('月份不能为空！');
                    isOK = false;
                }
                if (values.ZB === undefined) {
                    values.ZB = '';
                }
                if (values.YF === undefined) {
                    values.YF = '';
                }
                if (values.YF !== '') {
                    formatDate = new Date(values.YF.get('year'), values.YF.get('month'), 1, 8, 0, 0)
                }
                data.DSVL = Number(values.ZB);
                //data.DSDT = values.YF === !values.YF ? null : formatDate
                data.DSDT = values.YF
            }
        });
        if (!isOK) {
            return;
        }
        if (this.state.searchData.ID < 0 || this.state.searchData.No.indexOf(":") > 0) {
            message.error('分配失败！员工：' + this.state.searchData.Name + '为虚拟员工，不支持业绩分配！请重新选择')
            return;
        }
        data.EMID = this.state.searchData.ID;                    //员工ID
        data.EMNO = this.state.searchData.No;                    //员工编号
        data.SysUserName = this.state.searchData.Name;           //员工名称
        data.OrganName = this.state.searchData.Organization.Name;//开户机构
        let diviDs = this.state.diviDataSource
        //验证：添加的员工是否重复，并累加已分配比例是否超出100%
        for (let i = 0; i < diviDs.length; i++) {
            if (Number(diviDs[i]["EMID"]) === Number(data["EMID"])) {
                message.error('分配失败！所选员工已分配，请重新选择员工分配！');
                return;
            }
        }
        let diviSum = data.DSVL;
        diviDs.map(d => diviSum += d.DSVL)
        if (diviSum > 100) {
            message.info('占比不能大于100！');
            return;
        }
        diviDs.push(data);
        this.setState({ diviDataSource: diviDs });
    };
    diviDel() {
        let keys = this.refs.table3.getSelectedRowKeys();
        keys.sort();
        const datas = this.refs.table3.state.datas;
        let indexs = [];
        const keyName = 'EMID'
        datas.map((d, k) => {
            for (let i = 0; i < keys.length; i++) {
                if (d[keyName] === keys[i]) {
                    indexs.push(k)
                }
            }
        })
        let diviDsource = this.state.diviDataSource;
        for (let j = indexs.length - 1; j >= 0; j--) {
            const k = indexs[j]
            diviDsource.splice(k, 1)
        }
        this.setState({ diviDataSource: diviDsource })
    };
    diviSubmit() {
        const datas = this.refs.table3.state.datas;
        const dList = this.state.diviList
        // let ret = false
        // for (let i = 0; i < dList.length; i++) {
        //     if (dList[i].ISXJK) {
        //         ret = true
        //         break;
        //     }
        // }
        // if(ret){
        //     message.info('请使用小京卡认定流程认定!');
        //     return;
        // }
        let len = this.props.selectedRowKeys.length;
        if (len <= 0) {
            message.info('请选择要认定的账户!');
            return;
        }
        let iskh = this.state.ISKH;
        let acid = this.props.selectedRowKeys;
        let dsvlSum = 0;
        let dataSource = []
        datas.map(d => {
            dsvlSum = dsvlSum + d.DSVL;
            let data = {
                EMID: Number(d.EMID),
                DSDT: d.DSDT,
                DSVL: Number(d.DSVL) / 100
            }
            dataSource.push(data);
        })
        if (dsvlSum !== 100) {
            message.info('占比必须为100%');
            return;
        }
        if (iskh === 0) {
            Modal.confirm({
                title: '提示',
                content: `你确认要按账户认定给 ${datas.map(d => d.SysUserName + '(' + d.EMNO + ')')} 吗？`,
                okText: '确定',
                cancelText: '取消',
                onOk: () => {
                    IndiDiviService.indiDivi({ acid, dataSource }
                    ).then(function (data) {
                        if (data === 'OK') {
                            this.state.diviList = []
                            this.state.diviDataSource = []
                            this.state.ISKH = 1
                            const form = this.refs.diviForm.getForm();
                            form.resetFields();
                            message.success('数据认定成功！')
                        } else {
                            message.error('数据认定失败！' + data)
                            return;
                        }
                        this.props.dispatch({
                            type: `${daoName}/setSelectedRowKeys`,
                            payload: { selectedRowKeys: [] }
                        });
                    }.bind(this)).catch(function (ex) {
                        console.log('请求出错', ex)
                    });
                }
            });
        } else {
            Modal.confirm({
                title: '提示',
                content: `你确认要按客户认定给 ${datas.map(d => d.SysUserName + '(' + d.EMNO + ')')} 吗？`,
                okText: '确定',
                cancelText: '取消',
                onOk: () => {
                    IndiDiviService.indiDivikh({ acid, dataSource }
                    ).then(function (data) {
                        if (data === 'OK') {
                            this.state.diviList = []
                            this.state.diviDataSource = []
                            this.state.ISKH = 1
                            const form = this.refs.diviForm.getForm();
                            form.resetFields();
                            message.success('数据认定成功！')
                        } else {
                            message.error('数据认定失败！' + data)
                            return;
                        }
                        this.props.dispatch({
                            type: `${daoName}/setSelectedRowKeys`,
                            payload: { selectedRowKeys: [] }
                        });
                    }.bind(this)).catch(function (ex) {
                        console.log('请求出错', ex)
                    });
                }
            });
        }

    };
    SelDivi(value) {
        let isdivi = ''
        let whereItems = [];
        let WhereCauses = [];
        if (value === 'all') {
            isdivi = '0,1'
        } else {
            isdivi = value
        }
        whereItems.push({
            FieldName: "ISDIVI",
            Operator: "in",
            FieldValues: isdivi
        })
        whereItems.push({
            FieldName: "ID",
            Operator: ">",
            FieldValues: '0'
        })
        WhereCauses.push({
            WhereItems: whereItems,
            RelationSign: "AND"
        })
        let seeks = WhereCauses
        this.props.dispatch({
            type: `${daoName}/fetch`,
            payload: { daoName, page: 1, pageSize: 20, seeks }
        });
    }
    SetIndiIsmrOK() {
        const keys = this.props.selectedRowKeys;
        const len = keys.length;
        if (len === 0) {
            message.info('请选择要设置的数据行！');
            return;
        }
        let acid = keys[0]
        IndiDiviService.SetIndiIsmrOK({ acid }
        ).then(function (data) {
            if (data === 'OK') {
                this.findData()
                message.success('设置成功！')
            } else {
                message.error('设置失败！' + data)
                return;
            }
        }.bind(this)).catch(function (ex) {
            console.log('请求出错', ex)
        });
    }
    SetIndiIsmrNO() {
        const keys = this.props.selectedRowKeys;
        const len = keys.length;
        if (len === 0) {
            message.info('请选择要设置的数据行！');
            return;
        }
        let acid = keys[0]
        IndiDiviService.SetIndiIsmrNO({ acid }
        ).then(function (data) {
            if (data === 'OK') {
                this.findData()
                message.success('设置成功！')
            } else {
                message.error('设置失败！' + data)
                return;
            }
        }.bind(this)).catch(function (ex) {
            console.log('请求出错', ex)
        });
    }
    SetISKH(value) {
        if (value === "0") {
            this.state.ISKH = 0
        } else {
            this.state.ISKH = 1
        }
    }
    render() {
        let { showEdit, record, offsetHeight, permID, popedomTypes } = this.props;
        let table1Height = (offsetHeight - 133) * 0.5 - 150
        let data = [{ value: '1', label: '查询', onClick: this.findData.bind(this) }, { value: '2', label: '设为默认关联', onClick: this.SetIndiIsmrOK.bind(this) }, { value: '3', label: '取消默认关联', onClick: this.SetIndiIsmrNO.bind(this) }]
        // let pTypes = popedomTypes[permID]
        // if (pTypes.indexOf("6") !== -1) {
        //     data.push({ value: '2', label: this.state.diviDisplay.lable, onClick: this.dispalyDivi.bind(this) })
        // }
        let dataList = this.state.diviList;
        const dsCount = this.state.diviDataSource.length
        const isDisabled = dsCount > 0 ? true : false;
        const controlsFilter = [
            { name: 'ISDIVI', required: false, type: 'select', label: '选择', grid: 3 / 24, data: [{ value: 'all', label: '全部' }, { value: '1', label: '已分户' }, { value: '0', label: '未分户' }], onChange: this.SelDivi.bind(this), layout: { labelSpan: 8, wrapperSpan: 15 } },
            { name: 'KHMC', required: false, type: 'text', label: '客户', grid: 4 / 24, layout: { labelSpan: 7, wrapperSpan: 14 }, placeholder: '请输入客户...' },
            { name: 'ZJHM', required: false, type: 'text', label: '证件号码', grid: 5 / 24, layout: { labelSpan: 8, wrapperSpan: 15 }, placeholder: '请输入证件号码...' },
            { name: 'KH', required: false, type: 'text', label: '卡号', grid: 5 / 24, layout: { labelSpan: 6, wrapperSpan: 16 }, placeholder: '请输入卡号...' },
            { name: 'BT', required: false, type: 'button-group', data: data, grid: 7 / 24 },
        ];
        const controlsDivi2 = [
            { name: 'YG', required: false, type: 'search', label: '员工', grid: 5 / 24, layout: { labelSpan: 8, wrapperSpan: 15 }, fetch: { daoName: "UserSel", searchColumns: ['No', 'Name'], optionTpl: 'Name', valueTpl: "ID", onSelect: this.searchHandle.bind(this), permID: permID } },
            { name: 'ZB', required: false, type: 'input-number-min1', label: '占比(%)', grid: 4 / 24, layout: { labelSpan: 10, wrapperSpan: 9 } },
            { name: 'YF', required: false, type: 'date', label: '日期', grid: 6 / 24, isDisabled: isDisabled, layout: { labelSpan: 5, wrapperSpan: 14 } },
            { name: 'BT', required: false, type: 'button-group', data: [{ value: '1', label: '添加', onClick: this.diviAdd.bind(this) }, { value: '2', label: '删除', onClick: this.diviDel.bind(this) }, { value: '3', label: '提交', onClick: this.diviSubmit.bind(this) }], grid: 4 / 24 },
            { name: 'ISKH', required: false, type: 'select', label: '类型', grid: 5 / 24, data: [{ value: '1', label: '按客户' }, { value: '0', label: '按账户' }], onChange: this.SetISKH.bind(this), layout: { labelSpan: 6, wrapperSpan: 9 } },
        ];
        return (
            <div className={styles.normal} style={{ background: '#fff', marginTop: -16, padding: '5px 5px' }}>
                <div>
                    <div className={styles.create}>
                        <EditFrom ref="findForm" daoName={daoName} controls={controlsFilter} record={{ ISDIVI: 'all' }} selectFirst={false} clearItemMargin={true} />
                    </div>
                    <DataTable ref="table1" daoName={daoName} columns={columns} controls={controls} height={table1Height} canExport={false} multiSelect={this.state.diviDisplay.isDivi} onSelectChange={this.onSelectChangeHandler.bind(this)} permID={permID} />
                    <div style={{ display: this.state.diviDisplay.div1 }}><Dszhrd_fhqk permID={permID} /></div>

                    <DataEditTable columns={columnsDivi} ref="table3" height={table1Height}
                        dataSource={this.state.diviDataSource} footer={false} keyName={"EMID"} multiSelect={true}
                    />
                    <EditFrom ref="diviForm" daoName={daoName} controls={controlsDivi2} record={{ ISKH: "0" }} />

                    {/* <div style={{ display: this.state.diviDisplay.div2 }}>
                        <Row>
                            <Col span={10} style={{ paddingRight: 5 }}>
                                <DataEditTable columns={columnsWaitDivi} ref="table2" height={table1Height} controls={controlsWaitDivi}
                                    dataSource={dataList} keyName={"ID"} daoName={daoName} reload={true}
                                />
                            </Col>
                            <Col span={14}>
                                <DataEditTable columns={columnsDivi} ref="table3" height={table1Height}
                                    dataSource={this.state.diviDataSource} footer={false} keyName={"EMID"} multiSelect={true}
                                />
                                <EditFrom ref="diviForm" daoName={daoName}  controls={controlsDivi2} />
                            </Col>
                        </Row>
                    </div> */}
                </div>
            </div>
        )
    }
}

function mapStateToProps(state) {
    const { showEdit, record, selectedRowKeys, keyName, list } = state[daoName];
    const { offsetHeight, userID, orgID, pOrgID, popedomTypes } = state.menus
    return {
        userID,
        orgID,
        pOrgID,
        popedomTypes,
        showEdit,
        selectedRowKeys,
        keyName,
        record,
        offsetHeight,
        list
    }
}
Dszhrd = connect(mapStateToProps)(Dszhrd)
export default Dszhrd;

let render = (props) => React.createElement(Dszhrd, props);
let f = new Factory()
f.set("Dszhrd", render)
